﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ListTroGiup.ascx.cs" Inherits="CMS.Web.ListManager.ListTroGiup" %>
<table width="100%" align="center" class="Table_Border" style="border-collapse: collapse" cellSpacing="0" cellPadding="0" border="0">
    <tr>
        <td valign="middle" align="center" height="50px">
            <font class="Title">QUẢN TRỊ TRỢ GIÚP PHÁP LUẬT</font></td>
    </tr>   
    <tr>
        <td width="100%" align="center">
            <asp:GridView ID="gridObj" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID"
                Width="99%" CellPadding="4" ForeColor="#333333" GridLines="None" OnPageIndexChanging="gridObj_PageIndexChanging" BackColor="Transparent"
                EmptyDataText="Không có góp ý nào!!!" EmptyDataRowStyle-CssClass="Row_Error" OnRowCreated="gridObj_RowCreated" CssClass="Grid_Border">
                <Columns>
                    <asp:TemplateField>
                            <HeaderTemplate>
                              <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                            </HeaderTemplate>
                            <ItemTemplate >
                                <asp:CheckBox ID="chkSelect" runat="server" Enabled="true" />
                            </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="5%"/>
                        <ItemStyle HorizontalAlign="Center" Width="5%"/>
                    </asp:TemplateField>
                    <asp:BoundField DataField="HoTen" HeaderText="Họ v&#224; t&#234;n" SortExpression="HoTen">
                        <HeaderStyle HorizontalAlign="Left" Width="25%"/>
                        <ItemStyle HorizontalAlign="Left" Width="25%"/>
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Ti&#234;u đề">
                        <HeaderStyle HorizontalAlign="Left" Width="40%"/>
                        <ItemStyle HorizontalAlign="Left" Width="40%"/>
                        <ItemTemplate>
                           <a class="Link_Text" href="ListManager/GopYDetail.aspx?typeid=<%# Eval("ID")%>" onclick="return PopupWindow('ListManager/GopYDetail.aspx?gopyid=<%# Eval("ID")%>','600','300')" style="text-decoration:none">
                                <%# Eval("TieuDe")%>
                            </a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" >
                        <HeaderStyle HorizontalAlign="Left" Width="20%"/>
                        <ItemStyle HorizontalAlign="Left" Width="20%"/>
                    </asp:BoundField>      
                    <asp:TemplateField HeaderText="Trạng thái">
                        <HeaderStyle HorizontalAlign="Center" Width="10%"/>
                        <ItemStyle HorizontalAlign="Center" Width="10%"/>
                        <ItemTemplate>  
                            <%# ShowRead(Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "TrangThai")))%>
                        </ItemTemplate>
                    </asp:TemplateField>              
                   <%-- <asp:TemplateField HeaderText="File đ&#237;nh k&#232;m">
                        <HeaderStyle HorizontalAlign="Center" Width="15%"/>
                        <ItemStyle HorizontalAlign="Center" Width="15%"/>
                        <ItemTemplate>  
                            <a class="Link-button" href="sharedoc/gopy/<%# Eval("FileDinhKem")%>">    
                                <img src="Images/Download.ico" border="0" width="16px" height="16px" style="display:<%# ShowFileDinhKem(Convert.ToString(DataBinder.Eval(Container.DataItem, "FileDinhKem")))%>"/>  
                            </a>
                        </ItemTemplate>
                    </asp:TemplateField>     --%>              
                </Columns>
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" CssClass="Paging_Link" />                
                <RowStyle CssClass="Row_Document_Round" />
                <PagerStyle BackColor="Transparent" CssClass="Paging_NotLink" HorizontalAlign="Right" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="False" ForeColor="#333333" />
                <HeaderStyle CssClass="Row_Document_Title" />
                <EditRowStyle BackColor="Transparent" />
                <AlternatingRowStyle CssClass="Row_Document_Odd" />
                <EmptyDataRowStyle CssClass="Row_Document_Error" />
            </asp:GridView>
        </td>
    </tr>
    <tr height="25">
		<td width="100%" style="padding-left:5px; padding-top: 5px; height: 25px;" align="left">
            <asp:Button id="lbnXoa" Text="Xóa" Width="90px" CssClass="Button" runat="server" OnClick="lbnXoa_Click" Visible="false"/>
            <asp:Button id="lbnDuyet" Text="Trạng thái" Width="90px" CssClass="Button" runat="server" OnClick="lbnHienThi_Click" />
        </td>
	</tr>
</table>

<script language="javascript">
    function PopupWindow(url,width,height)
    {
        var h = height;
        var w = width;
        newwindow=window.open(url,'name','resizable=no,scrollbars=1,height='+h+',width='+w+'');
        if (window.focus) {newwindow.focus()}
        return false;
    }

    function SelectAllCheckboxes(spanChk){
        var oItem = spanChk.children;
        var theBox= (spanChk.type=="checkbox") ? 
        spanChk : spanChk.children.item[0];
        xState=theBox.checked;
        elm=theBox.form.elements;
        for(i=0;i<elm.length;i++){
            if(elm[i].type=="checkbox" && elm[i].id!=theBox.id) {
                if(elm[i].checked!=xState)
                elm[i].click();
            }
        }
    }

    function doSetStatus(type){
        var count = 0;
        var allc = document.getElementsByTagName("input");   
        for (i=0; i < allc.length; i++){
            if (allc.item(i).type=='checkbox' && allc.item(i).id !="chkAll"){ 
                if (allc.item(i).checked)
                    count++;
            }
        }
        if (count==0){
            if (type==1){
                alert("Xin đánh dấu chọn trước khi cập nhật!");
            }else{
                alert("Xin đánh dấu chọn trước khi xóa!");
            }
            return false;
        }
        
        if (type==1) 
        {
            if(confirm("Bạn có thật sự muốn cập nhật trạng thái?")){
                return true;
            }
        } 
        else
        {
            if(confirm("Bạn có thật sự muốn muốn xóa?")){
                return true;
            }
        }       
        return false;       
    }
</script>